#include<bits/stdc++.h>
#define int long long 
#define rep(l,r,i) for(int i=l;i<=r;i++) 
#define per(l,r,i) for(int i=l;i>=r;i--) 
#define pi pair<int,int> 
#define mk make_pair 
using namespace std;
#define Maxn 1003 
int n,k,a[Maxn],f[Maxn][Maxn][2],g[Maxn][Maxn][2],sum[Maxn];
const int mod = 998244353;
int getsum(int l,int r) {
    return (sum[r]-sum[l-1]+mod)%mod;
}
int fsp(int x,int k) {
    int res = 1;
    while(k) {
        if(k&1)res = res*x%mod;
        x = x*x%mod; k >>= 1;
    } return res;
}
signed main()
{
    freopen("game2.in","r",stdin);
    freopen("game.out","w",stdout);
    cin>>n>>k;
    int A1 = 1,A2 = 1;
    rep(1,n-1,i)A1 = A1*i%mod;
    rep(1,n-k-1,i)A2 = A2*i%mod;
    rep(1,n,i)cin>>a[i],sum[i] = (sum[i-1]+a[i])%mod;
    g[0][0][0] ++;
    rep(1,n,i) {
        rep(0,k,j) {
            f[i][j][0] = (f[i][j][0]+g[i-1][j][0]*a[i]%mod+f[i-1][j][0])%mod,g[i][j][0] = (g[i][j][0]+g[i-1][j][0])%mod;
            f[i][j][0] = (f[i][j][0]+g[i-1][j][1]*a[i]%mod+f[i-1][j][1])%mod,g[i][j][0] = (g[i][j][0]+g[i-1][j][1])%mod;
            rep(1,min(i,j+1)-1,l) {
                f[i][j][0] = (f[i][j][0]+f[i-l][j-l][1]+g[i-l][j-l][1]*getsum(i-l+1,i)%mod+mod)%mod,g[i][j][0] = (g[i][j][0]+g[i-l][j-l][1])%mod;
                f[i][j][1] = (f[i][j][1]+f[i-l][j-l][0]-g[i-l][j-l][0]*getsum(i-l+1,i)%mod+mod)%mod,g[i][j][1] = (g[i][j][1]+g[i-l][j-l][0])%mod;
            }
        }
    }
    int res = (f[n][k][0]+f[n][k][1])%mod;
    cout<<res*fsp(A1*fsp(A2,mod-2)%mod,mod-2)%mod;
    cout<<"\n";
    cout<<res*fsp((g[n][k][0]+g[n][k][1])%mod,mod-2)%mod;
    return 0;
}